<template>
  <div class="more-action">
    <!-- 状态一 -->
    <van-cell-group v-if="!isReport">
      <!-- 1抛出事件，具体功能由父组件做 -->
      <van-cell @click="hHate">不感兴趣</van-cell>
      <van-cell is-link @click="isReport = true">反馈垃圾内容</van-cell>
      <van-cell @click="block">拉黑作者</van-cell>
    </van-cell-group>
    <!-- 状态二 反馈 -->
    <van-cell-group v-else>
      <van-cell icon="arrow-left" @click="isReport = false">返回</van-cell>
      <van-cell
        v-for="report in reports"
        :key="report.value"
        @click="$emit('report', report.value)"
      >
        {{ report.label }}
      </van-cell>
    </van-cell-group>
  </div>
</template>

<script>
// 传入不感兴趣中的主要内容
import reports from '@/constant/reports'
export default {
  name: 'MoreAction',
  data () {
    return {
      reports,
      // 是否处于状态二：反馈
      isReport: false
    }
  },
  methods: {
    // 点击不感兴趣
    // 1传文章编号
    // 2删除文章
    // 3关闭弹层
    hHate () {
      this.$emit('hate')
    },
    block () {
      this.$emit('block')
    }
  }
}
</script>

<style lang="less" scoped>
.more-action {
  border-radius: 4px;
}
</style>
